package com.example.schoolenterprisealliance.dialog;

import android.app.Dialog;
import android.content.Context;
import android.media.Image;
import android.os.Bundle;

import com.example.schoolenterprisealliance.io.MyBitmap;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.example.schoolenterprisealliance.R;

import java.io.IOException;

public class CertificateDialog extends Dialog {
    private String url;
    private ImageView iv_certificate;
    private ImageView iv_cancel;
    public CertificateDialog(@NonNull Context context, int themeResId,String url) {
        super(context, themeResId);
        this.url=url;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.content_certificate_dialog);
        iv_certificate=findViewById(R.id.iv_certificate);
        iv_cancel=findViewById(R.id.iv_cancel);
        try {
            Log.e("CertificateDialog",url);
            iv_certificate.setImageBitmap(MyBitmap.getBitmap(url));
        } catch (IOException e) {
            e.printStackTrace();
        }
        iv_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CertificateDialog.this.dismiss();
            }
        });
    }

}
